package persentation.presentUniversityDean;

import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import businesslogic.informBl.InformController;

public class Title extends JPanel {
	private static Image TITLE=new ImageIcon("Graphics/studentGraphics/title.png").getImage();

	private static ImageIcon exitImageIcon=new ImageIcon("Graphics/departmentDean/注销图标.png");
	private static ImageIcon exitImageIcon2=new ImageIcon("Graphics/departmentDean/高光注销图标.png");
	
	private JFrame frame;
	private MyTabbedPane tabbedPane;

	/**
	 * Create the panel.
	 */
	public Title(String id,JFrame frame,final MyTabbedPane tabbedPane) {
		setSize(1100, 110);
		setLayout(null);
		this.frame=frame;
		this.tabbedPane=tabbedPane;
		
		final JButton button = new JButton(exitImageIcon);
		button.setFont(new Font("微软雅黑", Font.PLAIN, 29));
		button.setBounds(960, -5, 60, 60);
		button.setOpaque(false);
		button.setContentAreaFilled(false);
		button.setBorderPainted(false);
		button.setToolTipText("退出");
		add(button);
		button.addMouseListener(new MouseListener() {
			
			@Override
			public void mouseReleased(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mousePressed(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseExited(MouseEvent arg0) {
				button.setBounds(960, -5, 60, 60);
				button.setIcon(exitImageIcon);
			}
			
			@Override
			public void mouseEntered(MouseEvent arg0) {
				button.setBounds(963, -5, 60, 60);
				button.setIcon(exitImageIcon2);
			}
			
			@Override
			public void mouseClicked(MouseEvent arg0) {
				int i=JOptionPane.showConfirmDialog(null,"确认退出系统？","确认",JOptionPane.YES_NO_OPTION);
				if(i==JOptionPane.YES_OPTION){
					System.exit(0);
				}
				
			}
		});
		
		
	}
	
	public void paintComponent(Graphics g){
		g.drawImage(TITLE, 0,0, 1100,88,null);
	}
}
